import { createRouter, createWebHashHistory } from 'vue-router'

const Index = () => import('../views/Index.vue')
const Articles = () => import('../views/Articles.vue')
const Login = () => import('../views/Login.vue')
const Management = () => import('../views/Management.vue')


const routes = [
  {
    path: '/',
    name: 'index',
    component: Index
  },
  {
    path: '/article/:id',
    name: 'article',
    component: Articles
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta  : {
      requiresLogin : false,
      title: '管理员登录'
    }
  },
  {
    path: '/management',
    name: 'management',
    component: Management,
    meta  : {
      requiresLogin : true,
      title: '后台管理'
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
